<template>
  <div class="box">{{ 1 + 1 }} {{ a }} + {{ b }} = {{ c }}</div>
  <div>
    <button @click="add">添加</button>
    {{ tt.a }} : {{ tt.d }} : {{ tt.e }}
    <div v-if="tt.e.a % 2 == 0">测试：{{ 1 + 2 }}</div>
    <button @click="pause">暂停</button>
  </div>
</template>
<script>
import TestMarkRaw from './class/TestMarkRaw.class.js'
import { markRaw } from 'vue'
export default {
  data() {
    return {
      a: 1,
      b: 2,
      tt: markRaw(new TestMarkRaw())
    }
  },
  computed: {
    c() {
      return this.a + this.b
    }
  },
  methods: {
    add() {
      this.a++
      console.log(`helloworld`)
      this.tt.add()
      //0.1 * 1.5 + 0.9 * 1 = 1.05
      this.tid = setInterval((res) => {
        console.log(`1111`)
      }, 1e3)
    },
    pause() {
      console.log(`结束`)
      clearInterval(this.tid)
    }
  },
  mounted() {
    console.log(`helloworld`)
  }
}
</script>
<style type="text/css">
.box {
  width: 100px;
  height: 100px;
  border: 1px solid #000;
}
</style>
